package cc.liyinghao.springsecuritydemo.controller;

import io.swagger.annotations.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequiredArgsConstructor
public class AuthorityController {

    @GetMapping("/hello_user_view")
    @PreAuthorize("hasAuthority('user:view')")
    public String admin() {
        return "user_view";
    }

    @GetMapping("/hello_user_edit")
    @PreAuthorize("hasAuthority('user:edit')")
    public String userEdit() {
        return "user_edit";
    }
}
